<?php
class Model{
  function __construct($modelData = null){
    if($modelData!==null){
      foreach ($modelData as $key => $value) {
        $className = get_class($this);
        if (property_exists($className, $key)){
          $setter = 'set_'.$key;
          $this->$setter($value);
        }
      }
    }
  }
}
?>